package com.doitedu.doit30.hbase.filter;

import com.doitedu.doit30.hbase.utils.HbaseUtil;
import org.apache.hadoop.hbase.CompareOperator;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.filter.*;

/**
 * @Date 22.6.12
 * @Created by HANGGE
 * @Description
 *   movie  = 1
 *
 *
 *   一定要根据某一个属性快速的获取值信息
 *   存储电影的评分数据
 *    000001    'cf:rate1' , '4'
 *    000001    'cf:rate2' , '3'
 *    000001    'cf:rate3' , '4'
 *    000001    'cf:rate4' , '1'
 *    000001    'cf:rate5' , '6'
 *
 *    电影的评论
 *    000001    'cf:pl01' , '还行'
 *    000001    'cf:pl02' , '可以'
 *    000001    'cf:pl03' , '可以1'
 *    000001    'cf:pl04' , '可以'
 *    000001    'cf:pl05' , 'good'
 *
 *   中心实体的  属性
 *
 *
 *   zss    tag01  A
 *    zss    tag02  B
 *     zss    tag03  C
 *      zss    tag04  X
 *       zss    tag05  P
 *
 */
public class Demo03 {
    public static void main(String[] args)  throws  Exception{
        Connection conn = HbaseUtil.getHbaseConnection();
        Table tb_movie = HbaseUtil.getTable(conn, "tb_movie");

        Scan scan = new Scan();

        RowFilter rowFilter = new RowFilter(CompareOperator.EQUAL, new BinaryPrefixComparator("000001".getBytes()));
        scan.setFilter(rowFilter);
        ResultScanner scanner = tb_movie.getScanner(scan);

        for (Result result : scanner) {
            HbaseUtil.showData(result);
        }
        conn.close();
        tb_movie.close();
    }


}
